package 泛型;

public class JiHe <T>{
    private T[] arr;
    private int size;

    public JiHe(int size) {
        this.size = size;
        arr=(T[]) new Object[size];
    }
    public void set(int index,T val){
        arr[index]=val;
    }

    public T get(int index){//返回某个下标的人
        return  arr[index];

    }
    public void show(){
        for (T e:arr){
            System.out.println(e+"\t");
        }
        System.out.println();
    }
    public static void main(String []args){
        JiHe<String> jh=new JiHe<>(5);
        jh.set(0,"tom");
        jh.set(1,"jerry");
        jh.set(2,"zhou");
        jh.set(3,"wang");
        jh.set(4,"he");
        jh.show();
        System.out.println(jh.get(1));
    }
}
